package com.ruoyi.report.forms.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.report.forms.domain.CngScadaAttributeCt;
import com.ruoyi.report.forms.service.ICngScadaAttributeCtService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 监控属性 SCADA监控属性Controller
 * 
 * @author ruoyi
 * @date 2024-02-29
 */
@RestController
@RequestMapping("/CngScadaAttributeCt")
public class CngScadaAttributeCtController extends BaseController
{
    @Autowired
    private ICngScadaAttributeCtService cngScadaAttributeCtService;

    /**
     * 查询监控属性 SCADA监控属性列表
     */
    /*@RequiresPermissions("system:ct:list")*/
    @GetMapping("/reportList")
    public TableDataInfo list(CngScadaAttributeCt cngScadaAttributeCt)
    {
        startPage();
        List<CngScadaAttributeCt> list = cngScadaAttributeCtService.selectCngScadaAttributeCtList(cngScadaAttributeCt);
        return getDataTable(list);
    }

    /**
     * 导出监控属性 SCADA监控属性列表
     */
    /*@RequiresPermissions("system:ct:export")*/
    @Log(title = "监控属性 SCADA监控属性", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CngScadaAttributeCt cngScadaAttributeCt)
    {
        List<CngScadaAttributeCt> list = cngScadaAttributeCtService.selectCngScadaAttributeCtList(cngScadaAttributeCt);
        ExcelUtil<CngScadaAttributeCt> util = new ExcelUtil<CngScadaAttributeCt>(CngScadaAttributeCt.class);
        util.exportExcel(response, list, "监控属性 SCADA监控属性数据");
    }

    /**
     * 获取监控属性 SCADA监控属性详细信息
     */
    /*@RequiresPermissions("system:ct:query")*/
    @GetMapping(value = "/{attributeId}")
    public AjaxResult getInfo(@PathVariable("attributeId") String attributeId)
    {
        return success(cngScadaAttributeCtService.selectCngScadaAttributeCtByAttributeId(attributeId));
    }

    /**
     * 新增监控属性 SCADA监控属性
     */
    /*@RequiresPermissions("system:ct:add")*/
    @Log(title = "监控属性 SCADA监控属性", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CngScadaAttributeCt cngScadaAttributeCt)
    {
        return toAjax(cngScadaAttributeCtService.insertCngScadaAttributeCt(cngScadaAttributeCt));
    }

    /**
     * 修改监控属性 SCADA监控属性
     */
    /*@RequiresPermissions("system:ct:edit")*/
    @Log(title = "监控属性 SCADA监控属性", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CngScadaAttributeCt cngScadaAttributeCt)
    {
        return toAjax(cngScadaAttributeCtService.updateCngScadaAttributeCt(cngScadaAttributeCt));
    }

    /**
     * 删除监控属性 SCADA监控属性
     */
    /*@RequiresPermissions("system:ct:remove")*/
    @Log(title = "监控属性 SCADA监控属性", businessType = BusinessType.DELETE)
	@DeleteMapping("/{attributeIds}")
    public AjaxResult remove(@PathVariable String[] attributeIds)
    {
        return toAjax(cngScadaAttributeCtService.deleteCngScadaAttributeCtByAttributeIds(attributeIds));
    }
}
